package com.cndw.kungfu.model.pet.domain;

/**
 * 排序 最大的靠前
 * 
 * @author fantadust [9677889@qq.com]
 * @date 2012-6-2 下午7:14:14
 */
public class PetSoulOrder implements Comparable<PetSoulOrder> {

	private int indexId;

	private PetSoul petSoul;

	private int exp;

	public PetSoulOrder(int indexId, PetSoul petSoul, int exp) {
		this.indexId = indexId;
		this.petSoul = petSoul;
		this.exp = exp;
	}

	@Override
	public int compareTo(PetSoulOrder o) {
		int s = o.getPetSoul().getColor() - getPetSoul().getColor();
		if (s == 0) {
			s = o.getPetSoul().getLevel() - getPetSoul().getLevel();
			if (s == 0) {
				s = o.getExp() - getExp();
				if (s == 0) {
					s = getPetSoul().getType() - o.getPetSoul().getType();//类别是小的靠前
					if (s == 0) {
						return getIndexId() - o.getIndexId();
					} else {
						return s;
					}

				} else {
					return s;
				}
			} else {
				return s;
			}
		} else {
			return s;
		}
	}

	public int getIndexId() {
		return indexId;
	}

	public void setIndexId(int indexId) {
		this.indexId = indexId;
	}

	public PetSoul getPetSoul() {
		return petSoul;
	}

	public void setPetSoul(PetSoul petSoul) {
		this.petSoul = petSoul;
	}

	public int getExp() {
		return exp;
	}

	public void setExp(int exp) {
		this.exp = exp;
	}

}
